function ListNode(val, next) {
        this.val = (val===undefined ? 0 : val)
        this.next = (next===undefined ? null : next)
     }
function list(arr){
    let length=arr.length;
    let head=new ListNode();
    let node = head;
    for(let i=0;i<length;i++){
        node.next=new ListNode(arr[i]);
        node=node.next;
    }
    return head.next;
}
module.exports={list,ListNode};